package com.ejemplos;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloActivity extends Activity {

	String name = "";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hello_world);
		
		name = savedInstanceState != null ? 
				savedInstanceState.getString("NAME") :
				getIntent().getExtras().getString("NAME");
				
		TextView text = (TextView) findViewById(R.id.text);
		text.setText("Hello " + name);
	}
	
	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putString("NAME", name);
	}
}
